-- strengthen3
-- create by panyl
-- 通用的强化属性类技能，绝对值

return {
    apply = function(source, target, skillId, round, para, extra)
        local effectRound = -1;
        extra = extra or {};
        local lastRound = extra.lastRound;

        if type(lastRound) == "number" then
            effectRound = round + lastRound + 1;
        elseif para[4] > 0 then
            -- 不包括本回合
            effectRound = round + para[4] + 1;
        end

        -- 1. 威力
        local v = para[3];

        local prop = { para[1], para[2], v, effectRound, };

        -- 增加命中动作
        SkillM.getSequence(target):hit(source, target, skillId);

        -- 旧的属性先删除
        PropM.deletePropById(target, "special", para[1]);

        -- 记录到特殊属性
        PropM.record(target, prop, "special");

        -- 重整属性
        PropM.arrangeProps(target);

        -- 作用目标
        return { target, };
    end,

    parse = function(desc)
        local arr = string.explode(desc, ",");
        return { tonumber(arr[1]), arr[2], tonumber(arr[3]), tonumber(arr[4] or -1) };
    end,

    -- 解析技能描述
    parseDesc = function(source, skillId, desc, para)
        -- 1. 威力
        local v = para[3];

        desc = string.gsub(desc, "{strengthen3}", v);

        -- 属性名称
        desc = string.gsub(desc, "{attrib}", FieldsM.getFieldName(para[2]));

        return desc;
    end,
};
